<template>
	<div class="song-wrapper">
		<div class="banner">
            <div class="hot-icon"></div>
            <div class="time">更新时间：{{ time }}</div>
		</div>
		<div>
			<song-list :list="list" mode="rank"/>
		</div>
	</div>
</template>

<script>
import moment from 'moment';
import eventBus from '@/event-bus';
export default {
    data() {
        return {
            time: moment().format('MM月DD日')
        }  
    },
	computed: {
		list() {
			return eventBus.hotSongList.playlist?.tracks
				.slice(0, 20)
				.map((item, i) => ({
					id: item.id,
					name: item.name, // 歌曲名
					maxBr: eventBus.hotSongList.privileges[i].downloadMaxbr, // 最大音质
					alias: item.alia[0], // 别名
					artists: item.ar, // 歌手数组
					albumName: item.al.name, // 专辑名
				}));
		},
	},
	created() {
		eventBus.$emit('updateHotSongList');
	},
};
</script>
<style scoped>
.song-wrapper {
	width: 100%;
	color: #333;
}
.banner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 145px;
    background-color: #a75844;
}
.hot-icon {
    background: url('https://s3.music.126.net/mobile-new/img/index_icon_2x.png?5207a28c3767992ca4bb6d4887c74880=') no-repeat;
    width: 142px;
    margin-left: 24px;
    height: 67px;
    background-position: -24px -30px;
    background-size: 166px 97px;
}
.time {
    color: #fff;
    margin: 12px 0 0 24px;
    font-size: 14px;
}
</style>